<!DOCTYPE html>
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <meta name="description" content="刘清政">
  <meta name="keyword" content="hexo-theme">
  
    <link rel="shortcut icon" href="/css/images/logo.png">
  
  <title>
    
      python/前端/2-HTML5常用标签 | Justin-刘清政的博客
    
  </title>
  <link href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.css" rel="stylesheet">
  <link href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/tomorrow.min.css" rel="stylesheet">
  
<link rel="stylesheet" href="/css/style.css">

  
    
<link rel="stylesheet" href="/css/plugins/gitment.css">

  
  <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
  <script src="//cdnjs.cloudflare.com/ajax/libs/nprogress/0.2.0/nprogress.min.js"></script>
  
    
<script src="/js/qrious.js"></script>

  
  
    
<script src="/js/gitment.js"></script>

  
  

  
<meta name="generator" content="Hexo 4.2.0"></head>
<div class="wechat-share">
  <img src="/css/images/logo.png" />
</div>

  <body>
    <header class="header fixed-header">
  <div class="header-container">
    <a class="home-link" href="/">
      <div class="logo"></div>
      <span>Justin-刘清政的博客</span>
    </a>
    <ul class="right-list">
      
        <li class="list-item">
          
            <a href="/" class="item-link">主页</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/tags/" class="item-link">标签</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/archives/" class="item-link">归档</a>
          
        </li>
      
        <li class="list-item">
          
            <a href="/about/" class="item-link">关于我</a>
          
        </li>
      
    </ul>
    <div class="menu">
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
      <span class="icon-bar"></span>
    </div>
    <div class="menu-mask">
      <ul class="menu-list">
        
          <li class="menu-item">
            
              <a href="/" class="menu-link">主页</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/tags/" class="menu-link">标签</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/archives/" class="menu-link">归档</a>
            
          </li>
        
          <li class="menu-item">
            
              <a href="/about/" class="menu-link">关于我</a>
            
          </li>
        
      </ul>
    </div>
  </div>
</header>

    <div id="article-banner">
  <h2>python/前端/2-HTML5常用标签</h2>



  <p class="post-date">2020-11-03</p>
    <!-- 不蒜子统计 -->
    <span id="busuanzi_container_page_pv" style='display:none' class="">
        <i class="icon-smile icon"></i> 阅读数：<span id="busuanzi_value_page_pv"></span>次
    </span>
  <div class="arrow-down">
    <a href="javascript:;"></a>
  </div>
</div>
<main class="app-body flex-box">
  <!-- Article START -->
  <article class="post-article">
    <section class="markdown-content"><h2 id="1、HTML文档结构"><a href="#1、HTML文档结构" class="headerlink" title="1、HTML文档结构"></a>1、HTML文档结构</h2><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;!DOCTYPE <span class="meta-keyword">html</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">html</span> <span class="attr">lang</span>=<span class="string">"zh-CN"</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">head</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">meta</span> <span class="attr">charset</span>=<span class="string">"UTF-8"</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">title</span>&gt;</span>css样式优先级<span class="tag">&lt;/<span class="name">title</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">head</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">body</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;/<span class="name">body</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">html</span>&gt;</span></span><br></pre></td></tr></table></figure>

<ol>
<li><!DOCTYPE html>声明为HTML5文档。</li>
<li><html>、</html>是文档的开始标记和结束的标记。是HTML页面的根元素，在它们之间是文档的头部（head）和主体（body）。</li>
<li><head>、<meta name="generator" content="Hexo 4.2.0"></head>定义了HTML文档的开头部分。它们之间的内容不会在浏览器的文档窗口显示。包含了文档的元（meta）数据。</li>
<li><title>、</title>定义了网页标题，在浏览器标题栏显示。</li>
<li><body>、</body>之间的文本是可见的网页主体内容。

</li>
</ol>
<p><strong>*注意：</strong>对于中文网页需要使用 <strong><meta charset="utf-8"></strong> 声明编码，否则会出现乱码。有些浏览器会设置 GBK 为默认编码，则你需要设置为 <strong><meta charset="gbk">。*</strong></p>
<h2 id="1、-文档声明"><a href="#1、-文档声明" class="headerlink" title="1、 文档声明"></a>1、 文档声明</h2><p>你可使用此声明在 Internet Explorer 6 及以后版本中切换为严格的标准兼容模式。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># HTML 5</span></span><br><span class="line">&lt;!DOCTYPE html&gt;</span><br><span class="line"><span class="comment"># HTML 4.01</span></span><br><span class="line">&lt;!DOCTYPE HTML PUBLIC <span class="string">"-//W3C//DTD HTML 4.01//EN"</span> <span class="string">"http://www.w3.org/TR/html4/strict.dtd"</span>&gt;</span><br><span class="line"><span class="comment"># XHTML 1.0</span></span><br><span class="line">&lt;!DOCTYPE html PUBLIC <span class="string">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span></span><br><span class="line"> <span class="string">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span>&gt;</span><br></pre></td></tr></table></figure>

<h2 id="2、主体结构标签"><a href="#2、主体结构标签" class="headerlink" title="2、主体结构标签"></a>2、主体结构标签</h2><ul>
<li><code>&lt;html&gt;&lt;/html&gt;</code> 此元素可告知浏览器其自身是一个 HTML 文档。</li>
<li><code>&lt;head&gt;&lt;/head&gt;</code> 用于定义文档的头部，它是所有头部元素的容器。<code>&lt;head&gt;</code> 中的元素可以引用脚本、指示浏览器在哪里找到样式表、提供元信息等等。</li>
<li><code>&lt;body&gt;&lt;/doby&gt;</code> 定义文档的主体</li>
</ul>
<p><strong>几个很重要的属性：</strong></p>
<ul>
<li>id：定义标签的唯一ID，HTML文档树中唯一</li>
<li>class：为html元素定义一个或多个类名（classname）(CSS样式类名)</li>
<li>style：规定元素的行内样式（CSS样式）</li>
</ul>
<h2 id="3、HEAD头部标签"><a href="#3、HEAD头部标签" class="headerlink" title="3、HEAD头部标签"></a>3、HEAD头部标签</h2><ul>
<li><code>&lt;title&gt;&lt;/title&gt;</code> 定义文档标题</li>
<li><code>&lt;base/&gt;</code> 标签为页面上的所有链接规定默认地址或默认目标</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">元素可提供有关页面的元信息（meta-information），比如针对搜索引擎和更新频度的描述和关键词。标签永远位于 head 元素内部。</span><br></pre></td></tr></table></figure>

<ul>
<li><code>&lt;link&gt;&lt;/link&gt;</code> 标签定义文档与外部资源的关系。</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">link</span> <span class="attr">rel</span>=<span class="string">"stylesheet"</span> <span class="attr">type</span>=<span class="string">"text/css"</span>  <span class="attr">href</span>=<span class="string">"style.css"</span>&gt;</span><span class="tag">&lt;/<span class="name">link</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">link</span> <span class="attr">rel</span>=<span class="string">"shortcut icon"</span> <span class="attr">type</span>=<span class="string">"images/x-icon"</span> <span class="attr">href</span>=<span class="string">"http://www.baidu.com/favicon.ico"</span>&gt;</span></span><br></pre></td></tr></table></figure>

<ul>
<li><p><code>&lt;style&gt;&lt;/style&gt;</code>签用于为 HTML 文档定义样式信息。</p>
</li>
<li><p><code>&lt;script&gt;&lt;/script&gt;</code> 标签用于定义客户端脚本，比如 JavaScript。script 元素既可以包含脚本语句，也可以通过 src 属性指向外部脚本文件。</p>
</li>
</ul>
<h2 id="4、meta元信息"><a href="#4、meta元信息" class="headerlink" title="4、meta元信息"></a>4、meta元信息</h2><ul>
<li><meta>元素可提供有关页面的元信息（mata-information）,针对搜索引擎和更新频度的描述和关键词。</li>
<li><meta>标签位于文档的头部，不包含任何内容。</li>
<li><meta>提供的信息是用户不可见的。

</li>
</ul>
<p>meta标签的组成：meta标签共有两个属性，它们分别是http-equiv属性和name 属性，不同的属性又有不同的参数值，这些不同的参数值就实现了不同的网页功能。 </p>
<p>1.http-equiv属性：相当于http的文件头作用，它可以向浏览器传回一些有用的信息，以帮助正确地显示网页内容，与之对应的属性值为content，content中的内容其实就是各个参数的变量值。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">&lt;!--指定文档的编码类型(需要知道)--&gt;</span><br><span class="line">&lt;meta http-equiv&#x3D;&quot;content-Type&quot; charset&#x3D;UTF8&quot;&gt;  </span><br><span class="line">&lt;!--2秒后跳转到对应的网址，注意引号(了解)--&gt;</span><br><span class="line">&lt;meta http-equiv&#x3D;&quot;refresh&quot; content&#x3D;&quot;2;URL&#x3D;https:&#x2F;&#x2F;www.baidu.com&quot;&gt;</span><br><span class="line">&lt;!--告诉IE以最高级模式渲染文档(了解)--&gt;</span><br><span class="line">&lt;meta http-equiv&#x3D;&quot;x-ua-compatible&quot; content&#x3D;&quot;IE&#x3D;edge&quot;&gt;</span><br></pre></td></tr></table></figure>

<p>2.name属性: 主要用于描述网页，与之对应的属性值为content，content中的内容主要是便于搜索引擎机器人查找信息和分类信息用的。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">&lt;meta name&#x3D;&quot;keywords&quot; content&#x3D;&quot;meta总结,html meta,meta属性,meta跳转&quot;&gt;</span><br><span class="line">&lt;meta name&#x3D;&quot;description&quot; content&#x3D;&quot;老男孩教育Python学院&quot;&gt;</span><br></pre></td></tr></table></figure>

<h2 id="5-Body内常用标签"><a href="#5-Body内常用标签" class="headerlink" title="5 Body内常用标签"></a>5 Body内常用标签</h2><h3 id="5-1-基本标签（块级标签和内联标签）"><a href="#5-1-基本标签（块级标签和内联标签）" class="headerlink" title="5.1 基本标签（块级标签和内联标签）"></a>5.1 基本标签（块级标签和内联标签）</h3><figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--</span></span><br><span class="line"><span class="comment">b,i,u,s,p,h1--h6,br,hr</span></span><br><span class="line"><span class="comment">--&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">b</span>&gt;</span>加粗<span class="tag">&lt;/<span class="name">b</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">i</span>&gt;</span>斜体<span class="tag">&lt;/<span class="name">i</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">u</span>&gt;</span>下划线<span class="tag">&lt;/<span class="name">u</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">s</span>&gt;</span>删除<span class="tag">&lt;/<span class="name">s</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">p</span>&gt;</span>段落标签<span class="tag">&lt;/<span class="name">p</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">h1</span>&gt;</span>标题1<span class="tag">&lt;/<span class="name">h1</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">h2</span>&gt;</span>标题2<span class="tag">&lt;/<span class="name">h2</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">h3</span>&gt;</span>标题3<span class="tag">&lt;/<span class="name">h3</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">h4</span>&gt;</span>标题4<span class="tag">&lt;/<span class="name">h4</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">h5</span>&gt;</span>标题5<span class="tag">&lt;/<span class="name">h5</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">h6</span>&gt;</span>标题6<span class="tag">&lt;/<span class="name">h6</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!--换行--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">br</span>&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="comment">&lt;!--水平线--&gt;</span><span class="tag">&lt;<span class="name">hr</span>&gt;</span></span><br></pre></td></tr></table></figure>

<h3 id="5-2-div标签和span标签"><a href="#5-2-div标签和span标签" class="headerlink" title="5.2 div标签和span标签"></a>5.2 div标签和span标签</h3><p>div标签用来定义一个块级元素，并无实际的意义。主要通过CSS样式为其赋予不同的表现。<br>span标签用来定义内联(行内)元素，并无实际的意义。主要通过CSS样式为其赋予不同的表现。</p>
<h4 id="块级元素与行内元素的区别"><a href="#块级元素与行内元素的区别" class="headerlink" title="块级元素与行内元素的区别"></a>块级元素与行内元素的区别</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 块级标签:独占一行（h1~h6	p div）</span></span><br><span class="line"><span class="number">1</span> 块儿级标签可以修改长宽 行内标签不可以 修改了也不会变化</span><br><span class="line"><span class="number">2</span> 块儿级标签内部可以嵌套任意的块儿级标签和行内标签</span><br><span class="line"><span class="number">3</span> 但是p标签虽然是块儿级标签 但是它只能嵌套行内标签 不能嵌套块儿级标签</span><br><span class="line"><span class="number">4</span> 如果你套了 问题也不大 因为浏览器会自动帮你解开(浏览器是直接面向用户的 不会轻易的报错 哪怕有报错用户也基本感觉不出来)</span><br><span class="line"><span class="comment"># 行内标签:自身文本多大就占多大（i u s b span）</span></span><br><span class="line"><span class="number">1</span> 行内标签不能嵌套块儿级标签 可以嵌套行内标签</span><br><span class="line">       </span><br><span class="line"><span class="comment"># 总结:</span></span><br><span class="line"> <span class="number">1</span> 只要是块儿级标签都可以嵌套任意的块儿级标签和行内标签</span><br><span class="line"> <span class="number">2</span> 但是p标签只能嵌套行内标签，不能包含块级标签，p标签也不能包含p标签（HTML书写规范）</span><br><span class="line"> <span class="number">3</span> 内联元素不能包含块级元素，它只能包含其它内联元素</span><br></pre></td></tr></table></figure>

<h4 id="div和span"><a href="#div和span" class="headerlink" title="div和span"></a>div和span</h4><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">上述的两个标签是在构造页面初期最常使用的 页面的布局一般先用div和span占位之后再去调整样式 尤其是div使用非常的频繁</span><br><span class="line">div你可以把它看成是一块区域 也就意味着用div来提前规定所有的区域</span><br><span class="line">之后往该区域内部填写内容即可</span><br><span class="line">而普通的文本先用span标签</span><br></pre></td></tr></table></figure>

<h3 id="5-3-img标签"><a href="#5-3-img标签" class="headerlink" title="5.3 img标签"></a>5.3 img标签</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;img src&#x3D;&quot;图片的路径&quot; alt&#x3D;&quot;图片未加载成功时的提示&quot; title&#x3D;&quot;鼠标悬浮时提示信息&quot; width&#x3D;&quot;宽&quot; height&#x3D;&quot;高(宽高两个属性只用一个会自动等比缩放)&quot;&gt;</span><br></pre></td></tr></table></figure>

<h3 id="5-4-a标签"><a href="#5-4-a标签" class="headerlink" title="5.4 a标签"></a>5.4 a标签</h3><p>超链接标签</p>
<p>所谓的超链接是指从一个网页指向一个目标的连接关系，这个目标可以是另一个网页，也可以是相同网页上的不同位置，还可以是一个图片，一个电子邮件地址，一个文件，甚至是一个应用程序</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">&lt;a href&#x3D;&quot;http:&#x2F;&#x2F;www.oldboyedu.com&quot; target&#x3D;&quot;_blank&quot; &gt;点我&lt;&#x2F;a&gt;</span><br></pre></td></tr></table></figure>

<p>href属性指定目标网页地址。该地址可以有几种类型：</p>
<ul>
<li>绝对URL - 指向另一个站点（比如 href=”<a href="http://www.jd.com）" target="_blank" rel="noopener">http://www.jd.com）</a></li>
<li>相对URL - 指当前站点中确切的路径（href=”index.htm”）</li>
<li>锚URL - 指向页面中的锚（href=”#top”）</li>
</ul>
<p>target：</p>
<ul>
<li>_blank表示在新标签页中打开目标网页</li>
<li>_self表示在当前标签页中打开目标网页</li>
</ul>
<h3 id="5-5-列表"><a href="#5-5-列表" class="headerlink" title="5.5 列表"></a>5.5 列表</h3><h4 id="1-无序列表"><a href="#1-无序列表" class="headerlink" title="1.无序列表"></a>1.无序列表</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&lt;ul type&#x3D;&quot;disc&quot;&gt;</span><br><span class="line">  &lt;li&gt;第一项&lt;&#x2F;li&gt;</span><br><span class="line">  &lt;li&gt;第二项&lt;&#x2F;li&gt;</span><br><span class="line">&lt;&#x2F;ul&gt;</span><br></pre></td></tr></table></figure>

<p>type属性：</p>
<ul>
<li>disc（实心圆点，默认值）</li>
<li>circle（空心圆圈）</li>
<li>square（实心方块）</li>
<li>none（无样式）</li>
</ul>
<h4 id="2-有序列表"><a href="#2-有序列表" class="headerlink" title="2.有序列表"></a>2.有序列表</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&lt;ol type&#x3D;&quot;1&quot; start&#x3D;&quot;2&quot;&gt;</span><br><span class="line">  &lt;li&gt;第一项&lt;&#x2F;li&gt;</span><br><span class="line">  &lt;li&gt;第二项&lt;&#x2F;li&gt;</span><br><span class="line">&lt;&#x2F;ol&gt;</span><br></pre></td></tr></table></figure>

<p>type属性：</p>
<ul>
<li>1 数字列表，默认值</li>
<li>A 大写字母</li>
<li>a 小写字母</li>
<li>Ⅰ大写罗马</li>
<li>ⅰ小写罗马</li>
</ul>
<h4 id="3-标题列表"><a href="#3-标题列表" class="headerlink" title="3.标题列表"></a>3.标题列表</h4><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">&lt;dl&gt;</span><br><span class="line">  &lt;dt&gt;标题1&lt;&#x2F;dt&gt;</span><br><span class="line">  &lt;dd&gt;内容1&lt;&#x2F;dd&gt;</span><br><span class="line">  &lt;dt&gt;标题2&lt;&#x2F;dt&gt;</span><br><span class="line">  &lt;dd&gt;内容1&lt;&#x2F;dd&gt;</span><br><span class="line">  &lt;dd&gt;内容2&lt;&#x2F;dd&gt;</span><br><span class="line">&lt;&#x2F;dl&gt;</span><br></pre></td></tr></table></figure>

<h3 id="5-6-表格"><a href="#5-6-表格" class="headerlink" title="5.6 表格"></a>5.6 表格</h3><p>表格是一个二维数据空间，一个表格由若干行组成，一个行又有若干单元格组成，单元格里可以包含文字、列表、图案、表单、数字符号、预置文本和其它的表格等内容。<br>表格最重要的目的是显示表格类数据。表格类数据是指最适合组织为表格格式（即按行和列组织）的数据。<br>表格的基本结构：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">&lt;table&gt;</span><br><span class="line">  &lt;thead&gt;</span><br><span class="line">  &lt;tr&gt;</span><br><span class="line">    &lt;th&gt;序号&lt;&#x2F;th&gt;</span><br><span class="line">    &lt;th&gt;姓名&lt;&#x2F;th&gt;</span><br><span class="line">    &lt;th&gt;爱好&lt;&#x2F;th&gt;</span><br><span class="line">  &lt;&#x2F;tr&gt;</span><br><span class="line">  &lt;&#x2F;thead&gt;</span><br><span class="line">  &lt;tbody&gt;</span><br><span class="line">  &lt;tr&gt;</span><br><span class="line">    &lt;td&gt;1&lt;&#x2F;td&gt;</span><br><span class="line">    &lt;td&gt;Egon&lt;&#x2F;td&gt;</span><br><span class="line">    &lt;td&gt;杠娘&lt;&#x2F;td&gt;</span><br><span class="line">  &lt;&#x2F;tr&gt;</span><br><span class="line">  &lt;tr&gt;</span><br><span class="line">    &lt;td&gt;2&lt;&#x2F;td&gt;</span><br><span class="line">    &lt;td&gt;Yuan&lt;&#x2F;td&gt;</span><br><span class="line">    &lt;td&gt;日天&lt;&#x2F;td&gt;</span><br><span class="line">  &lt;&#x2F;tr&gt;</span><br><span class="line">  &lt;&#x2F;tbody&gt;</span><br><span class="line">&lt;&#x2F;table&gt;</span><br></pre></td></tr></table></figure>

<p>属性:</p>
<ul>
<li>border: 表格边框.</li>
<li>cellpadding: 内边距</li>
<li>cellspacing: 外边距.</li>
<li>width: 像素 百分比.（最好通过css来设置长宽）</li>
<li>rowspan: 单元格竖跨多少行</li>
<li>colspan: 单元格横跨多少列（即合并单元格）</li>
</ul>
<h3 id="5-7-form表单"><a href="#5-7-form表单" class="headerlink" title="5.7 form表单"></a>5.7 form表单</h3><h4 id="功能"><a href="#功能" class="headerlink" title="功能"></a>功能</h4><p>表单用于向服务器传输数据，从而实现用户与Web服务器的交互</p>
<p>表单能够包含input系列标签，比如文本字段、复选框、单选框、提交按钮等等。</p>
<p>表单还可以包含textarea、select、fieldset和 label标签。</p>
<h4 id="表单属性"><a href="#表单属性" class="headerlink" title="表单属性"></a>表单属性</h4><table>
<thead>
<tr>
<th align="center">属性</th>
<th align="center">描述</th>
</tr>
</thead>
<tbody><tr>
<td align="center">accept-charset</td>
<td align="center">规定在被提交表单中使用的字符集（默认：页面字符集）。</td>
</tr>
<tr>
<td align="center">action</td>
<td align="center">规定向何处提交表单的地址（URL）（提交页面）。</td>
</tr>
<tr>
<td align="center">autocomplete</td>
<td align="center">规定浏览器应该自动完成表单（默认：开启）。</td>
</tr>
<tr>
<td align="center">enctype</td>
<td align="center">规定被提交数据的编码（默认：url-encoded）。</td>
</tr>
<tr>
<td align="center">method</td>
<td align="center">规定在提交表单时所用的 HTTP 方法（默认：GET）。</td>
</tr>
<tr>
<td align="center">name</td>
<td align="center">规定识别表单的名称（对于 DOM 使用：document.forms.name）。</td>
</tr>
<tr>
<td align="center">novalidate</td>
<td align="center">规定浏览器不验证表单。</td>
</tr>
<tr>
<td align="center">target</td>
<td align="center">规定 action 属性中地址的目标（默认：_self）。</td>
</tr>
</tbody></table>
<h4 id="表单元素"><a href="#表单元素" class="headerlink" title="表单元素"></a>表单元素</h4><p>基本概念：<br>HTML表单是HTML元素中较为复杂的部分，表单往往和脚本、动态页面、数据处理等功能相结合，因此它是制作动态网站很重要的内容。<br>表单一般用来收集用户的输入信息<br>表单工作原理：<br>访问者在浏览有表单的网页时，可填写必需的信息，然后按某个按钮提交。这些信息通过Internet传送到服务器上。<br>服务器上专门的程序对这些数据进行处理，如果有错误会返回错误信息，并要求纠正错误。当数据完整无误后，服务器反馈一个输入完成的信息。</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line">from django.conf.urls import url</span><br><span class="line">from django.shortcuts import HttpResponse</span><br><span class="line"></span><br><span class="line">def upload(request):</span><br><span class="line">    print(&quot;request.GET:&quot;, request.GET)</span><br><span class="line">    print(&quot;request.POST:&quot;, request.POST)</span><br><span class="line"></span><br><span class="line">    if request.FILES:</span><br><span class="line">        filename &#x3D; request.FILES[&quot;file&quot;].name</span><br><span class="line">        with open(filename, &#39;wb&#39;) as f:</span><br><span class="line">            for chunk in request.FILES[&#39;file&#39;].chunks():</span><br><span class="line">                f.write(chunk)</span><br><span class="line">            return HttpResponse(&#39;上传成功&#39;)</span><br><span class="line">    return HttpResponse(&quot;收到了！&quot;)</span><br><span class="line"></span><br><span class="line">urlpatterns &#x3D; [</span><br><span class="line">    url(r&#39;^upload&#x2F;&#39;, upload),</span><br><span class="line">]</span><br></pre></td></tr></table></figure>



<h3 id="5-8-input"><a href="#5-8-input" class="headerlink" title="5.8 input"></a>5.8 input</h3><p><input> 元素会根据不同的 type 属性，变化为多种形态。</p>
<table>
<thead>
<tr>
<th align="center">type属性值</th>
<th align="center">表现形式</th>
<th align="center">对应代码</th>
</tr>
</thead>
<tbody><tr>
<td align="center">text</td>
<td align="center">单行输入文本</td>
<td align="center">&lt;input type=text” /&gt;</td>
</tr>
<tr>
<td align="center">password</td>
<td align="center">密码输入框</td>
<td align="center"><input type="password" /></td>
</tr>
<tr>
<td align="center">date</td>
<td align="center">日期输入框</td>
<td align="center"><input type="date" /></td>
</tr>
<tr>
<td align="center">checkbox</td>
<td align="center">复选框</td>
<td align="center"><input type="checkbox" checked="checked" /></td>
</tr>
<tr>
<td align="center">radio</td>
<td align="center">单选框</td>
<td align="center"><input type="radio" /></td>
</tr>
<tr>
<td align="center">submit</td>
<td align="center">提交按钮</td>
<td align="center"><input type="submit" value="提交" /></td>
</tr>
<tr>
<td align="center">reset</td>
<td align="center">重置按钮</td>
<td align="center"><input type="reset" value="重置" /></td>
</tr>
<tr>
<td align="center">button</td>
<td align="center">普通按钮</td>
<td align="center"><input type="button" value="普通按钮" /></td>
</tr>
<tr>
<td align="center">hidden</td>
<td align="center">隐藏输入框</td>
<td align="center"><input type="hidden" /></td>
</tr>
<tr>
<td align="center">file</td>
<td align="center">文本选择框</td>
<td align="center"><input type="file" /></td>
</tr>
</tbody></table>
<p> 属性说明:</p>
<ul>
<li>name：表单提交时的“键”，注意和id的区别</li>
<li>value：表单提交时对应项的值<ul>
<li>type=”button”, “reset”, “submit”时，为按钮上显示的文本年内容</li>
<li>type=”text”,”password”,”hidden”时，为输入框的初始值</li>
<li>type=”checkbox”, “radio”, “file”，为输入相关联的值</li>
</ul>
</li>
<li>checked：radio和checkbox默认被选中的项</li>
<li>readonly：text和password设置只读</li>
<li>disabled：所有input均适用</li>
</ul>
<h3 id="5-9-select标签"><a href="#5-9-select标签" class="headerlink" title="5.9 select标签"></a>5.9 select标签</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">&lt;form action&#x3D;&quot;&quot; method&#x3D;&quot;post&quot;&gt;</span><br><span class="line">  &lt;select name&#x3D;&quot;city&quot; id&#x3D;&quot;city&quot;&gt;</span><br><span class="line">    &lt;option value&#x3D;&quot;1&quot;&gt;北京&lt;&#x2F;option&gt;</span><br><span class="line">    &lt;option selected&#x3D;&quot;selected&quot; value&#x3D;&quot;2&quot;&gt;上海&lt;&#x2F;option&gt;</span><br><span class="line">    &lt;option value&#x3D;&quot;3&quot;&gt;广州&lt;&#x2F;option&gt;</span><br><span class="line">    &lt;option value&#x3D;&quot;4&quot;&gt;深圳&lt;&#x2F;option&gt;</span><br><span class="line">  &lt;&#x2F;select&gt;</span><br><span class="line">&lt;&#x2F;form&gt;</span><br></pre></td></tr></table></figure>

<p>属性说明：</p>
<ul>
<li>multiple：布尔属性，设置后为多选，否则默认单选</li>
<li>disabled：禁用</li>
<li>selected：默认选中该项</li>
<li>value：定义提交时的选项值</li>
</ul>
<h3 id="5-10-label标签"><a href="#5-10-label标签" class="headerlink" title="5.10 label标签"></a>5.10 label标签</h3><p>定义：<label> 标签为 input 元素定义标注（标记）。<br>说明：</p>
<ol>
<li>label 元素不会向用户呈现任何特殊效果。</li>
<li><label> 标签的 for 属性值应当与相关元素的 id 属性值相同。</li>
</ol>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">&lt;form action&#x3D;&quot;&quot;&gt;</span><br><span class="line">  &lt;label for&#x3D;&quot;username&quot;&gt;用户名&lt;&#x2F;label&gt;</span><br><span class="line">  &lt;input type&#x3D;&quot;text&quot; id&#x3D;&quot;username&quot; name&#x3D;&quot;username&quot;&gt;</span><br><span class="line">&lt;&#x2F;form&gt;</span><br></pre></td></tr></table></figure>

<h3 id="5-11-textarea多行文本"><a href="#5-11-textarea多行文本" class="headerlink" title="5.11 textarea多行文本"></a>5.11 textarea多行文本</h3><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">&lt;textarea name&#x3D;&quot;memo&quot; id&#x3D;&quot;memo&quot; cols&#x3D;&quot;30&quot; rows&#x3D;&quot;10&quot;&gt;</span><br><span class="line">  默认内容</span><br><span class="line">&lt;&#x2F;textarea&gt;</span><br></pre></td></tr></table></figure>

<p>属性说明：</p>
<ul>
<li>name：名称</li>
<li>rows：行数</li>
<li>cols：列数</li>
<li>disabled：禁用</li>
</ul>
<h2 id="6-其他了解"><a href="#6-其他了解" class="headerlink" title="6 其他了解"></a>6 其他了解</h2><h3 id="6-1-格式排版标签"><a href="#6-1-格式排版标签" class="headerlink" title="6.1 格式排版标签"></a>6.1 格式排版标签</h3><ul>
<li><code>&lt;br/&gt;</code> 换行标签，完成文字的紧凑显示。可以使用连续多个<code>&lt;br/&gt;</code>标签来换行</li>
<li><code>&lt;hr/&gt;</code> 水平分割线标签，用于段落与段落之间的分割</li>
<li><code>&lt;p&gt;&lt;/p&gt;</code>段落标签,里面可以加入文字,列表,表格等，可以<p></p>或<p />使用</li>
<li><code>&lt;pre&gt;&lt;/pre&gt;</code>按原文显示标签，可以把原文件中的空格,回车,换行,tab键表现出来</li>
<li><code>&lt;hn&gt;&lt;/hn&gt;</code> 标题字标签，n为1-6，定义六级标题，而且会自动换行插入一个空行</li>
<li><code>&lt;div&gt;&lt;/div&gt;</code> 没有任何语义的标签</li>
</ul>
<h3 id="6-2-文本标签"><a href="#6-2-文本标签" class="headerlink" title="6.2 文本标签"></a>6.2 文本标签</h3><ul>
<li><code>&lt;em&gt;&lt;/em&gt;</code> 表示强调，通常为斜体字</li>
<li><code>&lt;strong&gt;&lt;/strong&gt;</code> 表示强调(语气更强)，通常为粗体字</li>
<li><code>&lt;del&gt;&lt;/del&gt;</code> 标签定义文档中已删除的文本。</li>
<li><code>&lt;ins&gt;&lt;/ins&gt;</code> 标签定义已经被插入文档中的文本</li>
<li><code>&lt;sub&gt;&lt;/sub&gt;</code> 文字下标字体标签</li>
<li><code>&lt;sup&gt;&lt;/sup&gt;</code> 文字上标字体标签</li>
<li><code>&lt;mark&gt;&lt;/mark&gt;</code> <strong>H5新增</strong> 标签定义带有记号的文本 请在需要突出显示文本时使用,如搜索引擎搜索页面</li>
<li><code>&lt;ruby&gt;&lt;/ruby&gt;</code> <strong>H5新增</strong> 标签定义 ruby 注释（中文注音或字符） 在东亚使用，显示的是东亚字符的发音。</li>
<li><code>&lt;rt&gt;&lt;/rt&gt;</code> <strong>H5新增</strong> 标签定义字符（中文注音或字符）的解释或发音</li>
</ul>
<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">&lt;!--一下文本标签  作为了解--&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">cite</span>&gt;</span>    用于引证、举例、(标签定义作品（比如书籍、歌曲、电影、电视节目、绘画、雕塑等等）的标题)通常为斜体字</span><br><span class="line"><span class="tag">&lt;<span class="name">dfn</span>&gt;</span> 定义一个定义项目</span><br><span class="line"><span class="tag">&lt;<span class="name">code</span>&gt;</span> 定义计算机代码文本</span><br><span class="line"><span class="tag">&lt;<span class="name">samp</span>&gt;</span> 定义样式文本 标签并不经常使用。只有在要从正常的上下文中将某些短字符序列提取出来，对它们加以强调的极少情况下，才使用这个标签。</span><br><span class="line"><span class="tag">&lt;<span class="name">kbd</span>&gt;</span> 定义键盘文本。它表示文本是从键盘上键入的。它经常用在与计算机相关的文档或手册中。</span><br><span class="line"><span class="tag">&lt;<span class="name">abbr</span>&gt;</span> 定义缩写 配合title属性  (IE6以上)</span><br><span class="line"><span class="tag">&lt;<span class="name">bdo</span>&gt;</span>  来覆盖默认的文本方向 dir属性 值: lrt  rtl</span><br><span class="line"><span class="tag">&lt;<span class="name">var</span>&gt;</span> 定义变量。您可以将此标签与 <span class="tag">&lt;<span class="name">pre</span>&gt;</span> 及 <span class="tag">&lt;<span class="name">code</span>&gt;</span> 标签配合使用。</span><br><span class="line"><span class="tag">&lt;<span class="name">small</span>&gt;</span> 标签定义小型文本（和旁注）</span><br><span class="line"><span class="tag">&lt;<span class="name">b</span>&gt;</span>    粗体字标签 根据 HTML 5 的规范，<span class="tag">&lt;<span class="name">b</span>&gt;</span> 标签应该做为最后的选择，只有在没有其他标记比较合适时才使用它。</span><br><span class="line"><span class="tag">&lt;<span class="name">i</span>&gt;</span>    斜体字标签 标签被用来表示科技术语、其他语种的成语俗语、想法、宇宙飞船的名字等等。</span><br><span class="line"><span class="tag">&lt;<span class="name">u</span>&gt;</span>    下划线字体标签 标签定义与常规文本风格不同的文本，像拼写错误的单词或者汉语中的专有名词。 请尽量避免使用 <span class="tag">&lt;<span class="name">u</span>&gt;</span> 为文本加下划线，用户会把它混淆为一个超链接。</span><br><span class="line"><span class="tag">&lt;<span class="name">q</span>&gt;</span>  签定义一个短的引用。浏览器经常会在这种引用的周围插入引号。(小段文字)</span><br><span class="line"><span class="tag">&lt;<span class="name">blockquote</span>&gt;</span> 标签定义摘自另一个源的块引用。浏览器通常会对 <span class="tag">&lt;<span class="name">blockquote</span>&gt;</span> 元素进行缩进。(大段文字) (块状元素)</span><br><span class="line"><span class="tag">&lt;<span class="name">address</span>&gt;</span>  定义地址 通常为斜体 (注意非通讯地址)  块状元素</span><br><span class="line"><span class="tag">&lt;<span class="name">font</span>&gt;</span>       H5已删除 字体标签，可以通过标签的属性指定文字的大小、颜色及字体等信息</span><br><span class="line"><span class="tag">&lt;<span class="name">tt</span>&gt;</span>       H5已删除 打字机文字</span><br><span class="line"><span class="tag">&lt;<span class="name">big</span>&gt;</span>       H5已删除 大型字体标签</span><br><span class="line"><span class="tag">&lt;<span class="name">strike</span>&gt;</span>   H5已删除 添加删除线</span><br><span class="line"><span class="tag">&lt;<span class="name">acronym</span>&gt;</span>  H5已删除 首字母缩写 请使用<span class="tag">&lt;<span class="name">abbr</span>&gt;</span>代替</span><br><span class="line"><span class="tag">&lt;<span class="name">bdi</span>&gt;</span>      H5新增 标签允许您设置一段文本，使其脱离其父元素的文本方向设置。(经测试,各大浏览器都不起作用)</span><br><span class="line"><span class="tag">&lt;<span class="name">mark</span>&gt;</span>     H5新增 标签定义带有记号的文本 请在需要突出显示文本时使用,如搜索引擎搜索页面</span><br><span class="line"><span class="tag">&lt;<span class="name">meter</span>&gt;</span>    H5新增 定义预定义范围的度量</span><br><span class="line"><span class="tag">&lt;<span class="name">progress</span>&gt;</span> H5新增 标签标示任务的进度（进程）</span><br><span class="line"><span class="tag">&lt;<span class="name">time</span>&gt;</span>     H5新增 定义时间和日期 </span><br><span class="line"><span class="tag">&lt;<span class="name">wbr</span>&gt;</span>        H5新增    规定在文本中的何处适合添加换行符。Word Break Opportunity</span><br></pre></td></tr></table></figure></section>
    <!-- Tags START -->
    
    <!-- Tags END -->
    <!-- NAV START -->
    
  <div class="nav-container">
    <!-- reverse left and right to put prev and next in a more logic postition -->
    
      <a class="nav-left" href="/python/%E5%89%8D%E7%AB%AF/15-JQuery%E9%80%89%E6%8B%A9%E5%99%A8/">
        <span class="nav-arrow">← </span>
        
          python/前端/15-JQuery选择器
        
      </a>
    
    
      <a class="nav-right" href="/python/%E5%89%8D%E7%AB%AF/10-JavaScript%E5%87%BD%E6%95%B0/">
        
          python/前端/10-JavaScript函数
        
        <span class="nav-arrow"> →</span>
      </a>
    
  </div>

    <!-- NAV END -->
    <!-- 打赏 START -->
    
      <div class="money-like">
        <div class="reward-btn">
          赏
          <span class="money-code">
            <span class="alipay-code">
              <div class="code-image"></div>
              <b>使用支付宝打赏</b>
            </span>
            <span class="wechat-code">
              <div class="code-image"></div>
              <b>使用微信打赏</b>
            </span>
          </span>
        </div>
        <p class="notice">点击上方按钮,请我喝杯咖啡！</p>
      </div>
    
    <!-- 打赏 END -->
    <!-- 二维码 START -->
    
      <div class="qrcode">
        <canvas id="share-qrcode"></canvas>
        <p class="notice">扫描二维码，分享此文章</p>
      </div>
    
    <!-- 二维码 END -->
    
      <!-- Gitment START -->
      <div id="comments"></div>
      <!-- Gitment END -->
    
  </article>
  <!-- Article END -->
  <!-- Catalog START -->
  
    <aside class="catalog-container">
  <div class="toc-main">
  <!-- 不蒜子统计 -->
    <strong class="toc-title">目录</strong>
    
      <ol class="toc-nav"><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#1、HTML文档结构"><span class="toc-nav-text">1、HTML文档结构</span></a></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#1、-文档声明"><span class="toc-nav-text">1、 文档声明</span></a></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#2、主体结构标签"><span class="toc-nav-text">2、主体结构标签</span></a></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#3、HEAD头部标签"><span class="toc-nav-text">3、HEAD头部标签</span></a></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#4、meta元信息"><span class="toc-nav-text">4、meta元信息</span></a></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#5-Body内常用标签"><span class="toc-nav-text">5 Body内常用标签</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-1-基本标签（块级标签和内联标签）"><span class="toc-nav-text">5.1 基本标签（块级标签和内联标签）</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-2-div标签和span标签"><span class="toc-nav-text">5.2 div标签和span标签</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#块级元素与行内元素的区别"><span class="toc-nav-text">块级元素与行内元素的区别</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#div和span"><span class="toc-nav-text">div和span</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-3-img标签"><span class="toc-nav-text">5.3 img标签</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-4-a标签"><span class="toc-nav-text">5.4 a标签</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-5-列表"><span class="toc-nav-text">5.5 列表</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#1-无序列表"><span class="toc-nav-text">1.无序列表</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#2-有序列表"><span class="toc-nav-text">2.有序列表</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#3-标题列表"><span class="toc-nav-text">3.标题列表</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-6-表格"><span class="toc-nav-text">5.6 表格</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-7-form表单"><span class="toc-nav-text">5.7 form表单</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#功能"><span class="toc-nav-text">功能</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#表单属性"><span class="toc-nav-text">表单属性</span></a></li><li class="toc-nav-item toc-nav-level-4"><a class="toc-nav-link" href="#表单元素"><span class="toc-nav-text">表单元素</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-8-input"><span class="toc-nav-text">5.8 input</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-9-select标签"><span class="toc-nav-text">5.9 select标签</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-10-label标签"><span class="toc-nav-text">5.10 label标签</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#5-11-textarea多行文本"><span class="toc-nav-text">5.11 textarea多行文本</span></a></li></ol></li><li class="toc-nav-item toc-nav-level-2"><a class="toc-nav-link" href="#6-其他了解"><span class="toc-nav-text">6 其他了解</span></a><ol class="toc-nav-child"><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#6-1-格式排版标签"><span class="toc-nav-text">6.1 格式排版标签</span></a></li><li class="toc-nav-item toc-nav-level-3"><a class="toc-nav-link" href="#6-2-文本标签"><span class="toc-nav-text">6.2 文本标签</span></a></li></ol></li></ol>
    
  </div>
</aside>
  
  <!-- Catalog END -->
</main>

<script>
  (function () {
    var url = 'http://www.liuqingzheng.top/python/前端/2-HTML5常用标签/';
    var banner = ''
    if (banner !== '' && banner !== 'undefined' && banner !== 'null') {
      $('#article-banner').css({
        'background-image': 'url(' + banner + ')'
      })
    } else {
      $('#article-banner').geopattern(url)
    }
    $('.header').removeClass('fixed-header')

    // error image
    $(".markdown-content img").on('error', function() {
      $(this).attr('src', 'http://file.muyutech.com/error-img.png')
      $(this).css({
        'cursor': 'default'
      })
    })

    // zoom image
    $(".markdown-content img").on('click', function() {
      var src = $(this).attr('src')
      if (src !== 'http://file.muyutech.com/error-img.png') {
        var imageW = $(this).width()
        var imageH = $(this).height()

        var zoom = ($(window).width() * 0.95 / imageW).toFixed(2)
        zoom = zoom < 1 ? 1 : zoom
        zoom = zoom > 2 ? 2 : zoom
        var transY = (($(window).height() - imageH) / 2).toFixed(2)

        $('body').append('<div class="image-view-wrap"><div class="image-view-inner"><img src="'+ src +'" /></div></div>')
        $('.image-view-wrap').addClass('wrap-active')
        $('.image-view-wrap img').css({
          'width': `${imageW}`,
          'transform': `translate3d(0, ${transY}px, 0) scale3d(${zoom}, ${zoom}, 1)`
        })
        $('html').css('overflow', 'hidden')

        $('.image-view-wrap').on('click', function() {
          $(this).remove()
          $('html').attr('style', '')
        })
      }
    })
  })();
</script>


  <script>
    var qr = new QRious({
      element: document.getElementById('share-qrcode'),
      value: document.location.href
    });
  </script>



  <script>
    var gitmentConfig = "liuqingzheng";
    if (gitmentConfig !== 'undefined') {
      var gitment = new Gitment({
        id: "python/前端/2-HTML5常用标签",
        owner: "liuqingzheng",
        repo: "FuckBlog",
        oauth: {
          client_id: "32a4076431cf39d0ecea",
          client_secret: "94484bd79b3346a949acb2fda3c8a76ce16990c6"
        },
        theme: {
          render(state, instance) {
            const container = document.createElement('div')
            container.lang = "en-US"
            container.className = 'gitment-container gitment-root-container'
            container.appendChild(instance.renderHeader(state, instance))
            container.appendChild(instance.renderEditor(state, instance))
            container.appendChild(instance.renderComments(state, instance))
            container.appendChild(instance.renderFooter(state, instance))
            return container;
          }
        }
      })
      gitment.render(document.getElementById('comments'))
    }
  </script>




    <div class="scroll-top">
  <span class="arrow-icon"></span>
</div>
    <footer class="app-footer">
<!-- 不蒜子统计 -->
<span id="busuanzi_container_site_pv">
     本站总访问量<span id="busuanzi_value_site_pv"></span>次
</span>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_uv" style='display:none'>
     本站访客数<span id="busuanzi_value_site_uv"></span>人
</span>
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>



  <p class="copyright">
    &copy; 2021 | Proudly powered by <a href="https://www.cnblogs.com/xiaoyuanqujing" target="_blank">小猿取经</a>
    <br>
    Theme by <a href="https://www.cnblogs.com/xiaoyuanqujing" target="_blank" rel="noopener">小猿取经</a>
  </p>
</footer>

<script>
  function async(u, c) {
    var d = document, t = 'script',
      o = d.createElement(t),
      s = d.getElementsByTagName(t)[0];
    o.src = u;
    if (c) { o.addEventListener('load', function (e) { c(null, e); }, false); }
    s.parentNode.insertBefore(o, s);
  }
</script>
<script>
  async("//cdnjs.cloudflare.com/ajax/libs/fastclick/1.0.6/fastclick.min.js", function(){
    FastClick.attach(document.body);
  })
</script>

<script>
  var hasLine = 'true';
  async("//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js", function(){
    $('figure pre').each(function(i, block) {
      var figure = $(this).parents('figure');
      if (hasLine === 'false') {
        figure.find('.gutter').hide();
      }
      var lang = figure.attr('class').split(' ')[1] || 'code';
      var codeHtml = $(this).html();
      var codeTag = document.createElement('code');
      codeTag.className = lang;
      codeTag.innerHTML = codeHtml;
      $(this).attr('class', '').empty().html(codeTag);
      figure.attr('data-lang', lang.toUpperCase());
      hljs.highlightBlock(block);
    });
  })
</script>





<!-- Baidu Tongji -->

<script>
    var _baId = 'c5fd96eee1193585be191f318c3fa725';
    // Originial
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "//hm.baidu.com/hm.js?" + _baId;
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
</script>


<script src="/js/script.js"></script>


<script src="/js/search.js"></script>


<script src="/js/load.js"></script>



  <span class="local-search local-search-google local-search-plugin" style="right: 50px;top: 70px;;position:absolute;z-index:2;">
      <input type="search" placeholder="站内搜索" id="local-search-input" class="local-search-input-cls" style="">
      <div id="local-search-result" class="local-search-result-cls"></div>
  </span>


  </body>
</html>